//
//@File    :	12.4_string1.h
//@Time    :	2021/09/08 11:27:28
//@Auther  :	Sun Sheng
//@Contact :	970340843@qq.com
//@Desc    :	fixed and augumented string class definition
//

#ifndef STRING1_H_
#define STRING1_H_
#include <iostream>
using std::ostream;
using std::istream;

class String
{
private:
    char * str;//pointer to string
    int len;//length of string
    static int num_strings;//number of objects
    static const int CINLIM=80;//cin input limit
public:
//constructors and other methods
    String(const char * s);
    String();
    String(const String &);
    ~String();
    int length() const {return len;}
//overloaded operator methods
    String & operator=(const String &);
    String & operator=(const char *);
    char & operator[](int i);
    const char & operator[](int i) const;
//overloaded operator friends
    friend bool operator<(const String &st1,const String &st2);
    friend bool operator>(const String & st1,const String &st2);
    friend bool operator==(const  String &st1,const String &st2);
    friend ostream & operator<<(ostream & os,const String &st);
    friend istream & operator>>(istream & is,String & st);
//staatic function
    static int HowMany();
};
#endif	// STRING1_H_